/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author dukynguyen
 */
@Entity
@Table(name = "Category", catalog = "eProjectNational_Level_Paper", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Category.findAll", query = "SELECT c FROM Category c"),
    @NamedQuery(name = "Category.findByCaID", query = "SELECT c FROM Category c WHERE c.caID = :caID"),
    @NamedQuery(name = "Category.findByCaName", query = "SELECT c FROM Category c WHERE c.caName = :caName"),
    @NamedQuery(name = "Category.findByIDelete", query = "SELECT c FROM Category c WHERE c.iDelete = :iDelete")})
public class Category implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @Column(name = "CaID", nullable = false)
    private Integer caID;
    @Column(name = "CaName", length = 50)
    private String caName;
    @Column(name = "iDelete")
    private Boolean iDelete;
    @OneToMany(mappedBy = "category")
    private Collection<Event> eventCollection;

    public Category() {
    }

    public Category(Integer caID) {
        this.caID = caID;
    }

    public Integer getCaID() {
        return caID;
    }

    public void setCaID(Integer caID) {
        this.caID = caID;
    }

    public String getCaName() {
        return caName;
    }

    public void setCaName(String caName) {
        this.caName = caName;
    }

    public Boolean getIDelete() {
        return iDelete;
    }

    public void setIDelete(Boolean iDelete) {
        this.iDelete = iDelete;
    }

    public Collection<Event> getEventCollection() {
        return eventCollection;
    }

    public void setEventCollection(Collection<Event> eventCollection) {
        this.eventCollection = eventCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (caID != null ? caID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Category)) {
            return false;
        }
        Category other = (Category) object;
        if ((this.caID == null && other.caID != null) || (this.caID != null && !this.caID.equals(other.caID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Category[caID=" + caID + "]";
    }

}
